package wwl.lsf.imitateMybatis;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
import wwl.lsf.repository.LetCodeMapper;

//@Component
public class TestAutowiredImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {

  @Override
  public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata,
      BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator) {
    GenericBeanDefinition twoKindService = (GenericBeanDefinition) registry.getBeanDefinition("twoKindService");
    twoKindService.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
    registry.registerBeanDefinition("twoKindService", twoKindService);

  }
}
